﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpModelInterface.h"

namespace gcmp
{
    /// \breif 表示一条曲线在多边形中的索引，PolycurveIndexInPolygon表示曲线所属环在多边形中的索引，CurveIndexInPolycurve表示曲线在所属多段线中的索引
    struct GCMP_MODEL_INTERFACE_EXPORT CurveIndexInPolygon
    {
        /// \brief 构造方法
        ///
        /// \param[in] polycurveIndexInPolygon 曲线所属环在多边形中的索引
        /// \param[in] curveIndexInPolycurve 曲线在所属多段线中的索引
        CurveIndexInPolygon(int polycurveIndexInPolygon, int curveIndexInPolycurve)
            : PolycurveIndexInPolygon(polycurveIndexInPolygon)
            , CurveIndexInPolycurve(curveIndexInPolycurve) {}
        
        /// \brief 小于符号重载
        ///
        /// \param[in] other 另一个曲线索引
        /// \return 是否小于另一个曲线索引，优先按照PolycurveIndexInPolygon数值大小作比较，PolycurveIndexInPolygon相同时，按照CurveIndexInPolycurve数值大小作比较
        bool operator<(const CurveIndexInPolygon &other) const
        {
            return (PolycurveIndexInPolygon < other.PolycurveIndexInPolygon) ||
                (PolycurveIndexInPolygon == other.PolycurveIndexInPolygon && CurveIndexInPolycurve < other.CurveIndexInPolycurve);
        }

        /// 曲线所属环在多边形中的索引
        int PolycurveIndexInPolygon = 0;
        /// 曲线在所属多段线中的索引
        int CurveIndexInPolycurve = 0;
    };
}
